package com.itwn.portal.mapper;

import com.itwn.portal.entity.Collection;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface CollectionMapper {
    int insert(Collection record);

    List<Collection> selectAll();

    Collection selectOne(@Param("uid") Integer uid, @Param("rid") Integer rid);

    void delete(Collection collection);

    /**
     * 判断是否有收藏过
     * @param rid
     * @param uid
     * @return
     */
    @Select("select count(*) from t_collection where user_id=#{uid} and resource_id=#{rid}")
    int isCol(@Param("rid")Integer rid,@Param("uid") Integer uid);
}